import request from '@/utils/request'
//注册和登录
export const useUserRegister = ({ username, password, repassword }) =>
  request.post('/api/reg', { username, password, repassword })
export const useUserLogin = ({ username, password }) =>
  request.post('/api/login', { username, password })

//获取首页信息
export const useGetInfoService = () => request.get('/my/userinfo')

//更新用户信息
export const useUpdateUserInfoService = (obj) =>
  request.put('/my/userinfo', {
    ...obj
  })
//上传头像
export const userUploadAvatarService = (avatar) =>
  request.patch('/my/update/avatar', { avatar })

//更改密码
export const userUpdatePassService = ({ old_pwd, new_pwd, re_pwd }) =>
  request.patch('/my/updatepwd', { old_pwd, new_pwd, re_pwd })
